﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Expand.ComponentModel
{
    public class ListChangingEventArgs : EventArgs
    {
        public ListChangedType ListChangedType { get; private set; }

        public int NewIndex { get; private set; }

        public int OldIndex { get; private set; }

        public PropertyDescriptor PropertyDescriptor { get; private set; }

        protected ListChangingEventArgs(ListChangedType listChangedType, int newIndex, int oldIndex, PropertyDescriptor propDesc)
        {
            ListChangedType = listChangedType;
            NewIndex = newIndex;
            OldIndex = oldIndex;
            PropertyDescriptor = propDesc;
        }

        public ListChangingEventArgs(ListChangedType listChangedType, int newIndex)
            : this(listChangedType, newIndex, (-1), null) { }

        public ListChangingEventArgs(ListChangedType listChangedType, PropertyDescriptor propDesc)
            : this(listChangedType, (-1), (-1), propDesc) { }

        public ListChangingEventArgs(ListChangedType listChangedType, int newIndex, int oldIndex)
            : this(listChangedType, newIndex, oldIndex, null) { }

        public ListChangingEventArgs(ListChangedType listChangedType, int newIndex, PropertyDescriptor propDesc)
            : this(listChangedType, newIndex, (-1), propDesc) { }
    }
}
